﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problema1
{
    public interface CarFactory
    {
        masina CreeazaMasina();
    }
    public class MiniFactory : CarFactory
    {
        masina CarFactory.CreeazaMasina()
        {
            return new mini();
        }
    }
    public class SedanFactory : CarFactory
    {
        masina CarFactory.CreeazaMasina()
        {
            return new sedan();
        }
    }
    public class CoupeFactory : CarFactory
    {
        masina CarFactory.CreeazaMasina()
        {
            return new coupe();
        }
    }
    public class CumparaMasina
    {
        public static CarFactory getFactory()
        {
            Console.Write("Tipul de masina : \r\n  1.Sedan \r\n  2.Coupe\r\n  3.Mini\r\n");
            int t = 0;
            while (t < 1 || t > 3)
                t = Convert.ToInt32(Console.ReadLine());
            switch (t)
            {
                case 1: return new SedanFactory();
                case 2: return new CoupeFactory();
                case 3: return new MiniFactory();
                default: return null;
            }
        }
    }
}







